#include <vector>
#include <iostream>
using namespace std;


int binsearch(vector<int> v , int num)
{
  int left = 0;
  int right = v.size() - 1;

  while(left <= right)
  {
    int mid = (left + right) / 2 ;
    if (v[mid] == num)
    {
      return mid; 
    }
    else if (v[mid] > num)
    {
      right = mid - 1;
    }
    else 
    {
      left = mid + 1;
    }
  }

  return -1;
}

int main()
{
  vector<int> v1 = {0 , 1 , 4, 6, 7, 8, 9, 10 , 11 ,12};
  int ret = binsearch(v1 , 12); 
  cout << ret << endl;  
  return 0;
}
